package org.yzh.codec;

import io.github.yezhihao.protostar.FieldFactory;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import org.yzh.protocol.basics.JTMessage;
import org.yzh.protocol.codec.JTMessageDecoder;
import org.yzh.protocol.codec.MultiPacketDecoder;

/**
 * Description: MultiPacketElucidator
 * Copyright: Copyright (c) 2021
 * Company: FuLongMa Co., Ltd.
 * Create Time: 2021-08-12
 *
 * @author yinfeng
 */
public class MultiPacketElucidator {
    public static final MultiPacketDecoder decoder;

    static {
        FieldFactory.EXPLAIN = true;
        decoder = new MultiPacketDecoder("org.yzh.protocol");
    }

    public static void main(String[] args) {
        String[] hexArr = {
                "7E120523860040200004590AA100050001031800000090012107260313312107260358300000000000000000020101175F39FE0221072603133121072603583000000000000000000201011BD890280321072603133121072603583000000000000000000201010338BBC204210726031331210726035830000000000000000002010115D2EE6C0521072603133121072603583000000000000000000201011BFD8FEC06210726031331210726035830000000000000000002010103372F20072107260313312107260358300000000000000000020101033C0C92082107260313312107260358300000000000000000020101033F0FF0012107260358312107260442560000000000000000020101187D024C7C0221072603583121072604425600000000000000000201011B93077A0321072603583121072604425600000000000000000201010335E63C0421072603583121072604425600000000000000000201011677E6C20521072603583121072604425600000000000000000201011BB1D76A06210726035831210726044256000000000000000002010103390938072107260358312107260442560000000000000000020101032D715408210726035831210726044256000000000000000002010103322A2001210726044257210726045556000000000000000002010107CDD95402210726044257210726045556000000000000000002010108005F4603210726044257210726045556000000000000000002010100F49D2A042107260442572107260455560000000000000000020101075954EA0521072604425721072604555600000000000000000201010820E8D206210726044257210726045556000000000000000002010100F8030407210726044257210726045556000000000000000002010100F51FAA08210726044257210726045556000000000000000002010100F71552012107260456412107260541400000000000000000020101194101B20221072604564121072605414000000000000000000201011BC6717203210726045641210726054140000000000000000002010103576DE404210726045641210726054140000000000000000002010114B90C180521072604564121072605414000000000000000000201011C0A518E0621072604564121072605414000000000000000000201010359A7F607210726045641210726054140000000000000000002010103582F4808210726045641210726054140000000000000000002010103589EF0D07E",
                "7E120523800040200004590AA200050002012107260541412107260626400000000000000000020101195C0E180221072605414121072606264000000000000000000201011B3C470E032107260541412107260626400000000000000000020101032A7F3A0421072605414121072606264000000000000000000201011867235E0521072605414121072606264000000000000000000201011C073968062107260541412107260626400000000000000000020101033058DC072107260541412107260626400000000000000000020101033149F2082107260541412107260626400000000000000000020101032F4E980121072606264121072607114000000000000000000201011395B96E0221072606264121072607114000000000000000000201011BEB292C032107260626412107260711400000000000000000020101033BD00C0421072606264121072607114000000000000000000201011625AFE60521072606264121072607114000000000000000000201011C0327F8062107260626412107260711400000000000000000020101034453D2072107260626412107260711400000000000000000020101034224C20821072606264121072607114000000000000000000201010346C636012107260711412107260756400000000000000000020101160766600221072607114121072607564000000000000000000201011BDDDD76032107260711412107260756400000000000000000020101034D6F4A04210726071141210726075640000000000000000002010119FD08BA0521072607114121072607564000000000000000000201011BF2E6020621072607114121072607564000000000000000000201010351EA080721072607114121072607564000000000000000000201010350C432082107260711412107260756400000000000000000020101034EA57C0121072607564121072608414000000000000000000201011066CE160221072607564121072608414000000000000000000201011BCFFF900321072607564121072608414000000000000000000201010328295C04210726075641210726084140000000000000000002010119745B2E0521072607564121072608414000000000000000000201011C2811300621072607564121072608414000000000000000000201010324D3BA07210726075641210726084140000000000000000002010103293B900821072607564121072608414000000000000000000201010325730AC87E",
                "7E120523800040200004590AA3000500030121072608414121072609263400000000000000000201010E53C4200221072608414121072609263400000000000000000201011BB82D260321072608414121072609263400000000000000000201010327FD3E0421072608414121072609263400000000000000000201011BB22B1C0521072608414121072609263400000000000000000201011C0CB42C0621072608414121072609263400000000000000000201010327E0A80721072608414121072609263400000000000000000201010326610008210726084141210726092634000000000000000002010103325A3201210726092634210726101140000000000000000002010113F5E4300221072609263421072610114000000000000000000201011BEA0D1403210726092634210726101140000000000000000002010103612D0C0421072609263421072610114000000000000000000201011AD3B0E60521072609263421072610114000000000000000000201011C04011006210726092634210726101140000000000000000002010103626B76072107260926342107261011400000000000000000020101035B5FFA0821072609263421072610114000000000000000000201010358DF080121072610114121072610564000000000000000000201011511AAFA0221072610114121072610564000000000000000000201011BD4E7D80321072610114121072610564000000000000000000201010365832404210726101141210726105640000000000000000002010118AB15480521072610114121072610564000000000000000000201011CE4533E0621072610114121072610564000000000000000000201010357E342072107261011412107261056400000000000000000020101035B48C6082107261011412107261056400000000000000000020101035CF3E40121072610564121072611414000000000000000000201011765D9920221072610564121072611414000000000000000000201011BB5C2840321072610564121072611414000000000000000000201010334569E0421072610564121072611414000000000000000000201011A8EE5120521072610564121072611414000000000000000000201011BF20092062107261056412107261141400000000000000000020101032C71BE072107261056412107261141400000000000000000020101032A8D7408210726105641210726114140000000000000000002010103287702987E",
                "7E120523800040200004590AA400050004012107261141412107261226400000000000000000020101185BAE380221072611414121072612264000000000000000000201011B199C5C032107261141412107261226400000000000000000020101034BBD520421072611414121072612264000000000000000000201011242E6540521072611414121072612264000000000000000000201011C08D0C00621072611414121072612264000000000000000000201010344A410072107261141412107261226400000000000000000020101034A224008210726114141210726122640000000000000000002010103471C8A012107261226412107261311320000000000000000020101152F595A022107261226412107261311320000000000000000020101183EB03E032107261226412107261311320000000000000000020101033AF53804210726122641210726131132000000000000000002010113F1A4080521072612264121072613113200000000000000000201011BF680B4062107261226412107261311320000000000000000020101033DCAE00721072612264121072613113200000000000000000201010338B878082107261226412107261311320000000000000000020101033E1F380121072613113321072613564000000000000000000201011531D78E0221072613113321072613564000000000000000000201011BCA3454032107261311332107261356400000000000000000020101035C60920421072613113321072613564000000000000000000201011B8531480521072613113321072613564000000000000000000201011C12DBCE062107261311332107261356400000000000000000020101035B358007210726131133210726135640000000000000000002010103536F1C0821072613113321072613564000000000000000000201010356B8F00121072613564121072614225400000000000000000201010C97C936022107261356412107261422540000000000000000020101102C6DDE03210726135641210726142254000000000000000002010101E100400421072613564121072614225400000000000000000201010DAF929C0521072613564121072614225400000000000000000201011056591E06210726135641210726142254000000000000000002010101DD7F6A07210726135641210726142254000000000000000002010101DFCF2808210726135641210726142254000000000000000002010101E25548DB7E",
                "7E120521C00040200004590AA50005000501210726143017210726144348000000000000000002010104CC17E4022107261430172107261443480000000000000000020101085EFC3C03210726143017210726144348000000000000000002010100E69BF004210726143017210726144348000000000000000002010106801FD4052107261430172107261443480000000000000000020101086DEED406210726143017210726144348000000000000000002010100E6BCA207210726143017210726144348000000000000000002010100E62CF808210726143017210726144348000000000000000002010100E678940121072614454821072615095800000000000000000201010B7D02DD940221072614454821072615095800000000000000000201010EE61F0E03210726144548210726150958000000000000000002010101C3C8C40421072614454821072615095800000000000000000201010E1374180521072614454821072615095800000000000000000201010F059F7606210726144548210726150958000000000000000002010101C1AB5E07210726144548210726150958000000000000000002010101C4166208210726144548210726150958000000000000000002010101C2E218B27E"
        };

        for (int i = 0; i < hexArr.length; i++) {
            JTMessage message = decoder.decode(Unpooled.wrappedBuffer(ByteBufUtil.decodeHexDump(hexArr[i])));
            System.out.println();
            System.out.println(hexArr[i]);
            System.out.println(message);
        }
    }
}
